<?php
namespace Business;

class Article extends \Lib\Core\Business {

    /**
     * 添加文章
     *
     * @param $data
     *
     * @return i的返回Id
     */
    public function addArticle($data) {
        $id = \Data\Article::instance()->addArticle($data);
        return $id;
    }

    /**
     * 根据Id获取文章详情
     *
     * @param $id 文章Id
     *
     * @return array 返回文章详情数组
     */
    public function getArticleById($id) {
        $info = \Data\Article::instance()->getArticleById($id);
        return $info;
    }

    /**
     * 根据Id修改文章信息
     *
     * @param $id
     *
     * @param $data
     */
    public function updateArticle($id, $data) {
        \Data\Article::instance()->updateArticle($id, $data);
    }

    /**
     * 根据Id删除文章
     *
     * @param $id
     */
    public function delArticleById($id) {
        \Data\Article::instance()->delArticleById($id);
    }

    /**
     * 根据分类Id获取文章
     *
     * @param $categoryId
     * @param $pager
     * @return array
     */
    public function getAllArticleByCategoryId($categoryId, $pager) {
        return \Data\Article::instance()->getAllArticleByCategoryId($categoryId, $pager);
    }

    public function getArticleIdByCategoryId($categoryId) {
        return \Data\Article::instance()->getArticleIdByCategoryId($categoryId);
    }
}